package ioc;

import java.util.ArrayList;
import java.util.List;

public class HollywoodService {

    public static List<Agent> getFriendlyAgents() {
        // SpreadsheetAgentFinder 被死死的黏上了
        AgentFinder finder = new SpreadsheetAgentFinder();
        List<Agent> agents = finder.findAllAgents();
        return filterAgents(agents, "java");
    }

    private static List<Agent> filterAgents(List<Agent> agents, String java) {
        List<Agent> list = new ArrayList<>();
        for (Agent agent : agents) {
            if (agent.getType().equals(java)) {
                list.add(agent);
            }
        }
        return list;
    }


}
